package fastcsv.utils;
import java.util.Date;


import java.text.SimpleDateFormat;

public class common {
	
	public static SimpleDateFormat dateformatter = new SimpleDateFormat("YYYY/MM/dd HH:mm:ss.SSS");
	
	public static String format_filesize(double filesize) {
		String[] units = { "B", "K", "M", "G", "T", "P" };
		int uid = 0;
		double size = filesize;
		while (size > 1024) {
			size /= 1024;
			uid++;
		}

		return String.format("%.2f %s", size, units[uid]);
	}
	
	public static String get_time() {
		return dateformatter.format(new Date());
	}
}
